package com.wolfpire.workflow.om;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.wolfpire.workflow.em.WorkflowStatus;
/**
 * 流程定义
 * @author liushx
 *
 */
@Entity
@Table(name = "wf_workflow")
public class Workflow implements Serializable {

	private static final long serialVersionUID = 8912686080969508864L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "workflow_id", unique = true, nullable = false, length = 16)
	private Long workFlowId;

	@Column(name = "DEPLOYMENT_ID")
	private Long deploymentId;

	@Column(name = "FLOW_NAME")
	private String flowName;

	@Column(name = "STATUS", length = 1)
	private String status = WorkflowStatus.NORMAL.getIndex().toString();//流程状态
	
	@Column(name = "WFTYPEID")
	private String wftypeId;//流程类型ID
	
	@Column(name = "FORM_TYPE_ID")
	private String formTypeId;  // 表单类型ID
	
	@Column(name = "FLOW_XML")
	private String flowXml; // 流程XML

	@Column(name = "FILE_PATH")
	private String filePath; // 流程XML路径	
	
	@Column(name = "USER_NAME")
	private String userName; //创建人

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "CREATE_TIME")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")  
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") 
	private Date createDate = new Date(); // 创建时间
	
	@Column(name = "ORG_CODE")
	private String orgCode; //创建人组织机构
	
	@Column(name = "UPDATER")
	private String updater; //更新人

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "UPDATE_TIME")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")  
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") 
	private Date updateTime; //更新时间
	
	@Column(name = "RESPECT_ORGS_ID")
	private String respectOrgsId; //流程定义所属组织
	
	@Column(name = "TIME_LIMIT")
	private Long timeLimit;//超时限制
	
	@Column(name = "VERSION_")
	private Long version;//流程定义版本
	
	@Transient
	private String respectOrgName;
	
	public Workflow(Long workFlowId, Long deploymentId, String flowName,
			String status, String wftypeId, String formTypeId, String flowXml,
			String filePath, String userName, Date createDate, String orgCode,
			String updater, Date updateTime, String respectOrgsId,
			Long timeLimit, Long version, String respectOrgName) {
		super();
		this.workFlowId = workFlowId;
		this.deploymentId = deploymentId;
		this.flowName = flowName;
		this.status = status;
		this.wftypeId = wftypeId;
		this.formTypeId = formTypeId;
		this.flowXml = flowXml;
		this.filePath = filePath;
		this.userName = userName;
		this.createDate = createDate;
		this.orgCode = orgCode;
		this.updater = updater;
		this.updateTime = updateTime;
		this.respectOrgsId = respectOrgsId;
		this.timeLimit = timeLimit;
		this.version = version;
		this.respectOrgName = respectOrgName;
	}

	public Workflow() {
		super();
		// TODO Auto-generated constructor stub
	}

	public Long getWorkFlowId() {
		return workFlowId;
	}

	public void setWorkFlowId(Long workFlowId) {
		this.workFlowId = workFlowId;
	}

	public Long getDeploymentId() {
		return deploymentId;
	}

	public void setDeploymentId(Long deploymentId) {
		this.deploymentId = deploymentId;
	}

	public String getFlowName() {
		return flowName;
	}

	public void setFlowName(String flowName) {
		this.flowName = flowName;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getWftypeId() {
		return wftypeId;
	}

	public void setWftypeId(String wftypeId) {
		this.wftypeId = wftypeId;
	}

	public String getRespectOrgName() {
		return respectOrgName;
	}

	public void setRespectOrgName(String respectOrgName) {
		this.respectOrgName = respectOrgName;
	}

	public String getFormTypeId() {
		return formTypeId;
	}

	public void setFormTypeId(String formTypeId) {
		this.formTypeId = formTypeId;
	}

	public String getFlowXml() {
		return flowXml;
	}

	public void setFlowXml(String flowXml) {
		this.flowXml = flowXml;
	}

	public String getFilePath() {
		return filePath;
	}

	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public String getOrgCode() {
		return orgCode;
	}

	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}

	public String getUpdater() {
		return updater;
	}

	public void setUpdater(String updater) {
		this.updater = updater;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getRespectOrgsId() {
		return respectOrgsId;
	}

	public void setRespectOrgsId(String respectOrgsId) {
		this.respectOrgsId = respectOrgsId;
	}

	public Long getTimeLimit() {
		return timeLimit;
	}

	public void setTimeLimit(Long timeLimit) {
		this.timeLimit = timeLimit;
	}

	public Long getVersion() {
		return version;
	}

	public void setVersion(Long version) {
		this.version = version;
	} 
	
	
}
